#include <bits/stdc++.h>
using namespace std;
int n, m, l, r, mid, ans, x[500007];

bool check(int num)
{
	int temp = x[0], flag = 1;
	for (int i = 1; i < n; i++)
	{
		if (x[i] - temp >= num)
		{
			temp = x[i], flag++;
		}
		if (flag >= m)
			return true;
	}
	return false;
}
int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> x[i];
	}
	sort(x, x + n);
	r = x[n - 1];
	while (l <= r)
	{
		mid = l + (r - l) / 2;
		if (check(mid))
			l = mid + 1, ans = mid;
		else
			r = mid - 1;
	}
	cout << ans;
	return 0;
}